cmake_minimum_required(VERSION 3.14)
project(hik_camera)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(MSVC)
    add_compile_options("/source-charset:utf-8")
    add_compile_options("/execution-charset:utf-8")
endif()

# 设置文件输出路径
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)

# 收集源文件
file(GLOB_RECURSE SOURCE_FILES ${PROJECT_SOURCE_DIR}/src/*.cpp)

# OpenCV 设置
set(OpenCV_INCLUDE_DIRS E:/local/opencv/build/include E:/local/opencv/build/include/opencv2)
set(OpenCV_LIBS_DIRS E:/local/opencv/build/x64/vc15/lib)

#  OpenCV 库
set(OpenCV_DEBUG_LIB E:/local/opencv/build/x64/vc15/lib/opencv_world450d.lib)
set(OpenCV_RELEASE_LIB E:/local/opencv/build/x64/vc15/lib/opencv_world450.lib)

# 添加链接库路径
if(DEFINED OpenCV_LIBS_DIRS)
    link_directories(${OpenCV_LIBS_DIRS})
endif()

# 包含头文件目录
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${PROJECT_SOURCE_DIR}/include)

# 创建可执行文件
add_executable(${PROJECT_NAME} ${SOURCE_FILES})

# 链接 onnxruntime.lib
target_link_libraries(${PROJECT_NAME} PRIVATE
    $<$<CONFIG:Debug>:${OpenCV_DEBUG_LIB}>
    $<$<CONFIG:Release>:${OpenCV_RELEASE_LIB}>
    ${PROJECT_SOURCE_DIR}/lib/MvCameraControl.lib
)